﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Dare.Utilities.Data
{
    public class TransactionManagerException : Exception
    {
        public const int ERROR_CODE_DB_CONNECT_FAILED = -1;

        private int errorCode;
        public int ErrorCode
        {
            get { return errorCode; }
        }

        private static string GetErrorCodeMessage(int errorCode)
        {
            switch (errorCode)
            {
                case ERROR_CODE_DB_CONNECT_FAILED:
                    return "数据库连接失败!";
                default:
                    return String.Format("未知错误[ERROR CODE:{0}]", errorCode);
            }
        }

        public TransactionManagerException(int errorCode, Exception innerException)
            : base(GetErrorCodeMessage(errorCode), innerException)
        {
            this.errorCode = errorCode;
        }
    }
}
